package com.itheima.app.controller;

import com.itheima.app.manager.VoiceManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class VoiceController {

    @Autowired
    private VoiceManager voiceManager;
    //发送语音
    @PostMapping("/peachblossom")
    public void saveVoice(MultipartFile soundFile) throws IOException {
        //调用manager保存
        voiceManager.saveVoice(soundFile);
    }

    //接收语音
    @GetMapping("/peachblossom")
    public ResponseEntity getVoice(){
        //调用manager获取
       return voiceManager.getVoice();
    }


}
